# -*- coding: utf-8 -*-
import werobot

robot = werobot.WeRoBot(token='tokenhere', enable_session=True)

@robot.subscribe
def subscribe(message):
    return 'Hello My Friend!'

@robot.unsubscribe
def unsubscribe(message):
    return 'Hello My Friend!'

@robot.text
def text(message, session):
    last = session.get("last", None)
    if last:
        return last
    session["last"] = message.content
    return '这是你第一次和我说话'

@robot.filter("帮助")
def show_help(message):
    return """
    帮助
    XXXXX
    """
    
@robot.click
def click(message):
    if message.key == "abort":
        return "I'm a robot"

robot.run(port=10001)